﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZYStudios.Filter;
using ZYStudios.Models;

namespace ZYStudios.Controllers
{
    [DataForMasterPageFilter]
    public class ActivityController : BaseController
    {
        //
        // GET: /Activity/

        [OutputCache(Duration = int.MaxValue, VaryByParam = "*")]
        public ActionResult Index()
        {
            ZYStudios.Models.Data aData = new Models.Data();
            ZYStudios.Models.DataTableAdapters.ActivityTableAdapter aActivityAdapter = new Models.DataTableAdapters.ActivityTableAdapter();
            aActivityAdapter.Fill(aData.Activity);


            List<ActivityEditModel> ActivitysList = new List<ActivityEditModel>();
            foreach (var row in aData.Activity.ToArray())
            {
                ActivitysList.Add(new ActivityEditModel()
                {
                    ID = row.ID,
                    ActivityContent = row.ActivityContent,
                    ActivityName = row.ActivityName
                });
            }

            ViewData["Activitys"] = ActivitysList.Reverse<ActivityEditModel>().ToList();

            return View();
        }

    }
}
